﻿using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;

namespace AIRO.Devices.StepMotor
{
    [Guid("C435336C-571C-4efd-B825-0FF6813BB23C")]
    public enum StepMotorState
    {
        Running,
        Idle,
        Error,
        Programing
    }

    [Guid("D01E671B-BB23-4ec3-9E6D-853B94E94FAF")]
    [ClassInterface(ClassInterfaceType.None)]
    [ProgId("AIRO.Devices.StepMotor.StateChangedEventArgs")]
    public class StateChangedEventArgs : EventArgs
    {

        private StepMotorState _newState;

        public StateChangedEventArgs(StepMotorState newState)
        {
            this._newState = newState;
        }

        public StepMotorState State
        {
            get
            {
                return _newState;
            }
        }
    }

    [Guid("DBDB1EA7-980D-499e-A823-C12B3CA542DB")]
    [ClassInterface(ClassInterfaceType.None)]
    [ProgId("AIRO.Devices.StepMotor.FinishEventArgs")]
    public class FinishEventArgs:EventArgs
    {
        
    }


    [Guid("7F679431-9099-4864-8A94-0D4A5A2CF312")]
    [ClassInterface(ClassInterfaceType.None)]
    [ProgId("AIRO.Devices.StepMotor.ProgressEventArgs")]
    public class ProgressEventArgs : EventArgs
    {
        private double _step;
        public ProgressEventArgs(double step)
        {
            this._step = step;
        }
        public double Step
        {
            get
            {
                return _step;
            }
        }
    }


    [Guid("8962F958-2B67-4d11-9EDC-E42ACBCCF5BA")]
    [InterfaceType(ComInterfaceType.InterfaceIsDual)]   
    public interface IStepMotor
    {      
        [DispId(1)]
        StepMotorState State{get;}
        [DispId(2)]
        void BeginMove(int steps);
        [DispId(3)]
        void Move(int steps);
        [DispId(4)]
        event EventHandler<StateChangedEventArgs> StateChangedEvent;
        [DispId(5)]
        event EventHandler<FinishEventArgs> FinishEvent;
        [DispId(6)]
        event EventHandler<ProgressEventArgs> ProgressEvent;
    }
}
